package com.google.code.lightsomy.http;

import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.Context;
import org.mortbay.jetty.servlet.ServletHolder;

public class JettyRunner {
	
	private static Server server;
	
	public static void run() throws Exception {
		if (server == null) {
			server = new Server(8070);
			Context context = new Context(server, "/", Context.SESSIONS);
			context.addServlet(new ServletHolder(new LightsomyFrontController()), "/*");
			context.setResourceBase("./src/test/resources/");
			context.setClassLoader(Thread.currentThread().getContextClassLoader());
			server.start();
		}
	}
}
